package com.itheima.job;

import com.itheima.service.db.AnalysisByDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class AnalysisTask {

    @Autowired
    AnalysisByDayService analysisByDayService;

    //TODO 项目上线后注释掉此行
    @Scheduled(cron = "0 0/1 * * * ?")
    //TODO 项目上线每小时统计一次
    //@Scheduled(cron = "0 0 0/1 * * ?")
    public void syncAnalysisTask(){
        System.out.println("统计分析任务开始");
        analysisByDayService.saveOrUpdate();
        System.out.println("统计分析任务结束");
    }

}
